package cn.itsource.basic.util.job;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.Schedules;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
* 定时提醒类
* @author wangcp
* @date 2021/05/08 18:04
**/
@Component
public class TimingRemindTask {
    @Autowired
    private TaskService taskService;
//    @Schedules({@Scheduled(cron = "0 15 11,14,16 * * ? "),@Scheduled(cron = "0 0 18 * * ? ")})
    //@Schedules({@Scheduled(cron = "1,4,6 * * * * ?")})
    public void remindTask() throws InterruptedException {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        System.out.println("执行定时任务了,执行时间为：" + sdf.format(new Date()));
      //  taskService.executeRemindMessage();
    }
    //0 0/30 * * * ? 30分钟
    //0/10 * * * * ? *
    @Schedules({@Scheduled(cron = "0 0/30 * * * ?")})
    public void timeOutJob() throws InterruptedException {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        System.out.println("执行定时任务了,执行时间为：" + sdf.format(new Date()));
        taskService.timeOutJob();
    }
}